{ Statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=3130
  Verdict: Accepted
}
uses
	SysUtils, Math;
 
var  	
	i, j, ls : longint;
	a : array[0..110, 0..110] of longint;
	s, t : string;
 
begin
	reset(input,'input.txt');
	rewrite(output,'output.txt');
	readln(S);
	ls := length(S);
	t := '';
	for i := 1 to ls do
		t := s[i] + t;	
	for i := 1 to ls do
		for j := 1 to ls do
			if s[i] = t[j] then a[i][j] := a[i - 1][j - 1] + 1 else a[i][j] := max(a[i][j - 1], a[i - 1][j]);
	write(a[ls][ls]);
end.